Skip to content

feat(worksheet): port worksheet CRUD from Go CLI#15

Draft
beengud wants to merge 1 commit into
mainfrom
feat/worksheet
Draft

feat(worksheet): port worksheet CRUD from Go CLI#15
beengud wants to merge 1 commit into
mainfrom
feat/worksheet

Conversation

@beengud

@beengud beengud commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Closes #7

Ported surface

observe worksheet (list / get / create / delete), mirroring the deprecated Go CLI (cmd_worksheet.go, ot_worksheet.go). All operations validated against the published Observe GraphQL SDL.

  • worksheet list [--name <filter>] [--workspace <id>] [--format json|csv]worksheetSearch(terms: DWSearchInput!). Passes workspaceId/name into search terms (both list-typed in the SDL), then applies a case-insensitive substring filter client-side. Tabular by default; supports --format json|csv.
  • worksheet get <id> [--format json]worksheet(id: ObjectId!), JSON output including stages { id pipeline }.
  • worksheet create <file.json> [--workspace <id>]saveWorksheet(wks: WorksheetInput!). Reads a JSON WorksheetInput, strips read-only updatedDate, requires name/workspaceId/stages; --workspace overrides the file's workspaceId.
  • worksheet delete <id>deleteWorksheet(wks: ObjectId!)ResultStatus; prints a confirmation message and fails on success: false.

Registered in src/app.ts (above cli), documented in README Commands table and AGENTS.md Project Structure.

Field-name corrections vs initial guess (from the Go source)

The old Go CLI's hand-written queries disagreed with the published SDL; corrected to match the SDL:

  • Search result shape: Go used worksheetSearch { results { worksheet ... } }. SDL is WorksheetSearchResultWrapper { worksheets: [WorksheetSearchResult!]! } — corrected to worksheets.
  • Search input is list-typed: DWSearchInput.workspaceId: [ObjectId!] and name: [String!] — pass arrays, not scalars.
  • Stage field is id, not stageID: StageQuery/StageQueryInput expose id (mapped from StageID). The Go get query selected stages { stageID pipeline }, which would not validate — corrected to stages { id pipeline }. (Matches the brief's warning.)
  • Delete return type: deleteWorksheet returns ResultStatus { success errorMessage } (Go assumed the same shape; confirmed against base_public.graphql).

Verification

  • Codegen (scoped to src/gql/worksheet/**, schema = published TF-provider SDL): ✔ Generate — all four operations validate against the SDL.
  • Scoped typecheck (tsc --noEmit over src/commands/worksheet, src/gql/worksheet, src/lib, src/context.ts): no errors in worksheet sources. Remaining diagnostics are confined to *.test.ts and are only the expected bun:test / import.meta noise.
  • Tests: bun test src/commands/worksheet/13 pass, 0 fail (4 files; list/get/create/delete).

🤖 Generated with Claude Code

Add `observe worksheet` with list/get/create/delete subcommands,
mirroring the deprecated Go CLI. Operations are validated against the
published Observe GraphQL SDL.

- list: worksheetSearch with --name (case-insensitive substring) and
  --workspace; supports --format json|csv (table by default)
- get <id>: worksheet(id) including stages { id pipeline }
- create <file.json>: saveWorksheet(wks: WorksheetInput); strips
  read-only updatedDate; requires name, workspaceId, stages
- delete <id>: deleteWorksheet -> ResultStatus, prints confirmation

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port worksheet CRUD commands from the Go fork

2 participants